package com.maimao.goods.client;

import com.maimao.core.constant.ServiceContainer;
import com.maimao.core.interceptor.FeignInterceptor;
import com.maimao.core.model.resp.Result;
import com.maimao.goods.client.factory.ShopFallBackFactory;
import com.maimao.model.user.Shop;
import com.maimao.model.user.input.ShopBindBrand;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author MaoLin Wang
 * @date 2020/12/22 7:54 下午
 */
@RequestMapping("/web/shop")
@FeignClient(contextId = "shopClient", value = ServiceContainer.USER_SERVICE, fallbackFactory = ShopFallBackFactory.class, configuration = FeignInterceptor.class)
public interface ShopClient {

    @GetMapping("/by-owner")
    Result<Shop> findShopByOwner(@RequestParam("owner") Long owner, @RequestParam("social") Integer social);

    @GetMapping("/one/mmin")
    Result<Shop> queryByIdIn(@RequestParam("id") Long id);

    /**
     * 根据店铺id查询用户邮箱
     *
     * @param id 店铺id
     * @return 用户邮箱
     */
    @GetMapping("/queryUserEmailById")
    Result<String> queryUserEmailById(@RequestParam("id") Long id);

    /**
     * 店铺绑定品牌（品牌审核接口内部调用）
     */
    @PostMapping("/client/bindBrand")
    Result<Void> bindBrand(@RequestBody ShopBindBrand shopBindBrand);
}
